package com.demo10;

import java.util.Date;

public class DateDemo {
    public static void main(String[] args) {
        //实例化一个默认的日期对象
        Date date = new Date();

        System.out.println(date);

        date.setTime(1000*60*60*24*365*3);

        System.out.println(date);

        System.out.println(date.getTime() / 1000 / 60 / 60 / 24 / 365 + "年");

        //定时事件
        long time = 1000 * 60 * 60 * 24;

        Date date1 = new Date(time);

        System.out.println(date1);
    }
}
